package com.alks.function.controller.chengKong;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.chengKong.LotNoRequest;
import com.alks.function.data.request.chengKong.cost.InsertManufacturerRequest;
import com.alks.function.data.request.chengKong.cost.PcOutListPriceUpdateRequest;
import com.alks.function.data.request.factorywork.PcOutListPriceRequest;
import com.alks.function.service.pcfactorywork.IPcOutListPriceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@ApiRestController("/puttingOut")
@Api(tags = {"成控部-工厂成本作业-外发单价建档"})
@Slf4j
public class PcOutListPriceController {

    @Resource
    private IPcOutListPriceService pcOutListPriceService;

    @WebLogger
    @PostMapping("/OutsourcingProcessInquiry")
    @ApiOperation(value = "外发工艺单价",tags = "成控部-工厂成本作业-外发单价建档")
    public ResponseInfo OutsourcingProcessInquiry(@RequestBody PcOutListPriceRequest request) {
        return pcOutListPriceService.OutsourcingProcessInquiry(request);
    }

    @WebLogger
    @PostMapping("/TakeInstructionsForOutsourcingProjects")
    @ApiOperation(value = "取指令外发项目",tags = "成控部-工厂成本作业-外发单价建档")
    public ResponseInfo TakeInstructionsForOutsourcingProjects(@RequestBody LotNoRequest request) {
        return pcOutListPriceService.TakeInstructionsForOutsourcingProjects(request);
    }

    @WebLogger
    @PostMapping("/TakeProcessOutsourcingProjects")
    @ApiOperation(value = "取工艺外发项目",tags = "成控部-工厂成本作业-外发单价建档")
    public ResponseInfo TakeProcessOutsourcingProjects(@RequestBody LotNoRequest request) {
        return pcOutListPriceService.TakeProcessOutsourcingProjects(request);
    }

    @WebLogger
    @PutMapping("/InsertManufacturer")
    @ApiOperation(value = "插入厂商",tags = "成控部-工厂成本作业-外发单价建档")
    public ResponseInfo InsertManufacturer(@RequestBody List<InsertManufacturerRequest> request) {
        return pcOutListPriceService.InsertManufacturer(request);
    }

    @WebLogger
    @GetMapping("/ProcessDeletion")
    @ApiOperation(value = "工艺删除",tags = "成控部-工厂成本作业-外发单价建档")
    public ResponseInfo ProcessDeletion(@RequestParam Integer id) {
        return pcOutListPriceService.ProcessDeletion(id);
    }

    @WebLogger
    @PutMapping("/CheckTheBoxToCheckTheRecord/{choose}")
    @ApiOperation(value = "打勾记录检核 0检核/1取消检核", tags = "成控部-工厂成本作业-外发单价建档")
    public ResponseInfo CheckTheBoxToCheckTheRecord(@RequestBody List<InsertManufacturerRequest> request, @PathVariable("choose") Integer choose) {
        return pcOutListPriceService.CheckTheBoxToCheckTheRecord(request,choose);
    }

    @WebLogger
    @PutMapping("/ModificationOfOutsourcingUnitPrice")
    @ApiOperation(value = "外发工艺修改", tags = "成控部-工厂成本作业-外发单价建档")
    public ResponseInfo ModificationOfOutsourcingUnitPrice(@RequestBody PcOutListPriceUpdateRequest request) {
        return pcOutListPriceService.ModificationOfOutsourcingUnitPrice(request);
    }

    @WebLogger
    @PostMapping("/PcOutListPriceExport")
    @ApiOperation(value = "导出明细",tags = "成控部-工厂成本作业-外发单价建档")
    public void PcOutListPriceExport(@RequestBody PcOutListPriceRequest request, HttpServletResponse response) {
         pcOutListPriceService.PcOutListPriceExport(request,response);
    }
}
